package com.arvts.android.project;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.telephony.SmsManager;
import android.widget.Toast;

public class SMSClass {
	SmsManager smsManager;
	
    public SharedPreferences localSharedPreferences;
    public static final String SETTINGS = "SETTINGS";
	
    public static final String number = "number";
	@SuppressWarnings("deprecation")
	public void sendSMS(String number, Activity activity){
		
		smsManager = SmsManager.getDefault();
		localSharedPreferences = activity.getSharedPreferences(SETTINGS,Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE);
		smsManager.sendTextMessage(localSharedPreferences.getString(number,""), null, "I am on emergency ", null, null);
		Toast.makeText(activity, "SMS Sent!",Toast.LENGTH_LONG).show();
	}
}
